<?php

namespace App\Http\Models\Admin\Member;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Support\Facades\Hash as FacadesHash;

class Department extends Model
{
    use SoftDeletes;
    protected $table = "personnel";

    protected $hidden = ['api_token','password'];
    // protected $hidden = ['api_token','created_at','deleted_at','password'];
    
    
    /**
     * Hash password
     * @param $input
     */
    public function setPasswordAttribute($input)
    {
        if ($input)
            $this->attributes['password'] = app('hash')->needsRehash($input) ? FacadesHash::make($input) : $input;
    }


    public function newQuery()
    {
        global $_W;
        return parent::newQuery()->where('ascription', '=', 1);
    }
}
